package cn.zniot.so.transport.asynpack;

import cn.zniot.so.application.util.HexUtil;


/**
 * Zniot控制指令报文
 */
public class Zniot2PacketC extends AsynPacketD {

	private byte[] code;// 指令代码

	public Zniot2PacketC() {
		super(PacketType.Zniot);
	}

	public Zniot2PacketC(PacketType packType) {
		super(PacketType.Zniot);
	}
	public byte[] getbyteCode() {
		return this.code;
	}
	
	public String getCode() {
		if(code != null && code.length>1)
			try {
				return HexUtil.getHexString(code);
			} catch (Exception e) {
				return null;
			}
		else
			return null;
	}
	
	public void setCode(byte[] code) {
		this.code = new byte[code.length];
		System.arraycopy(code, 0, this.code, 0, code.length);
	}

}
